package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.PrivateMessage;
import cn.wolfcode.trip.base.query.PraiseQueryObject;
import cn.wolfcode.trip.base.query.PrivateMessageQueryObject;
import cn.wolfcode.trip.base.service.IPrivateMessageService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//该项目是符合REST规范的,此时该控制器表示操作用户的资源
@RestController //Controller+ResponseBody
@RequestMapping("/privatemessages")
public class PrivateMessageController {
    @Autowired
    private IPrivateMessageService privateMessageService;

    /*
    保存私信
    参数:很多...(参考数据库表)
     */
    @PostMapping("/save")
    public Object saveTravels(PrivateMessage entity) {
        privateMessageService.saveOrUpdate(entity);
        return new JSONResult();
    }
    /*
    获取当前私信
    参数:很多...(参考数据库表)
     */
    @GetMapping
    public Object get(Long id) {

        return  privateMessageService.get(id);
    }
    /*
      修改私信的小红点
     */
    @PutMapping("/state")
    public void update(PrivateMessageQueryObject qo) {
        privateMessageService.update(qo);
    }



}
